package com.LeeCode;

/**
 * 统计对称整数的数目
 */

public class Code2843 {
    public static void main(String[] args) {
        int low = 1200, high = 1230;
        System.out.println(new Code2843().countSymmetricIntegers(low, high));
    }

    public int countSymmetricIntegers(int low, int high) {
        int ans = 0;

        for (int i = low; i <= high; i++) {
            if (10 < i && i < 100 && i % 11 == 0) {
                ans++;
            }

            if (1000 < i && i < 10000) {
                int left = i / 100;
                int right = i % 100;
                if ((left / 10 + left % 10) == (right / 10 + right % 10)) {
                    ans++;
                }
            }
        }
        return ans;
    }
}
